package com.enation.app.shop.front.policyInsurance.service.impl;

import com.enation.app.shop.front.policyInsurance.entity.ClaimLoss;
import com.enation.app.shop.front.policyInsurance.service.ClaimLossMapper;
import com.enation.framework.database.IDaoSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("claimLossService")
public class ClaimLossService implements ClaimLossMapper{
    @Autowired
    private IDaoSupport daoSupport;
    @Override
    public int deleteByPrimaryKey(Long id) {
        String sql="delete from rbt_claims_loss where id=?";
        this.daoSupport.execute(sql,id);
        return 1;
    }

    @Override
    public int insert(ClaimLoss record) {
        this.daoSupport.insert("rbt_claims_loss",record);
        int id= this.daoSupport.getLastId("rbt_claims_loss");
        return id;
    }

    @Override
    public int insertSelective(ClaimLoss record) {
        return 0;
    }

    @Override
    public ClaimLoss selectByPrimaryKey(Long id) {
        return null;
    }

    @Override
    public int updateByPrimaryKeySelective(ClaimLoss record) {
        return 0;
    }

    @Override
    public int updateByPrimaryKey(ClaimLoss record) {
        this.daoSupport.update("rbt_claims_loss",record,"id="+record.getId());
        return 1;
    }

    @Override
    public List<ClaimLoss> getByClaimid(Long claimid) {
        String sql="select * from rbt_claims_loss  where claims_settlement_id=?";
        return this.daoSupport.queryForList(sql,ClaimLoss.class,claimid);
    }
}
